package es.pawer.android.listacompras.biz;

import es.pawer.android.listacompras.data.ItemTO;

/**
 * This class adds new behaviour to the Items.
 * When any item is selected, is marked, so it cannot be selected twice.
 * @author plo
 *
 */
public class Item extends ItemTO {

	private static final long serialVersionUID = -346673885529723029L;
	
	private boolean selected;
	private int price;

	public Item(ItemTO i) {
		this.setName(i.getName());
		this.setOrderPoints(i.getOrderPoints());
		this.setPrice(i.getPrice());
		this.setSelected(false);
	}
	
	public Item(String name) {
		super(name);
		this.selected=false;
	}

	/**
	 * Checks if this item has been already selected.
	 */
	public boolean isSelected() {
		return selected;
	}

	/**
	 * Selects or unselects the item.
	 */
	public void setSelected(boolean selected) {
		this.selected = selected;
	}

	public int getPrice() {
		return price;
	}

	public void setPrice(int price) {
		this.price = price;
	}

}